<?php
/**
* Api_View_Helper_CountryComboHelper class for Boomerang Referral Network
*
* Api_View_Helper_CountryComboHelper is the view helper class which is used to get
* country list which is suitable to populate country combo at view page 
* 
* @package      Api_View_Helper
* @copyright    Copyright (c) 2011-2012 Boomerang Referral Network
* @version      $Id: CountryComboHelper.php v 1.0.0$
* @since        Class available since Release 1.0.0
* @author       Anindya Roy Chodhury <anindya23@gmail.com>
*/
class Api_View_Helper_CountryComboHelper extends Zend_View_Helper_Abstract
{
    /**
     * Return Country combo list to the view page to populate country drop down
     * 
     * @return array
     */
    public function countryComboHelper()
    {
        $countryList = array();
        $em = Zend_Registry::get('doctrine')->getEntityManager();
        
        $countries = $em->getRepository('Api\Core\Entity\Country')->findAll();
        foreach ($countries as $country) {
            $countryList[$country->code] = $country->countryName;
        }
        return $countryList;
    }
}